import {BaseThree} from "../base/BaseThree";
import * as THREE from 'three'

export class AddText extends BaseThree {
  constructor( view, pos) {
    super(view,pos)
  }
  setup(pos) {
    var loader = new THREE.FontLoader();
    loader.load("./static/json/helvetiker_regular.typeface.json",  (res)=> {
      let font = new THREE.TextBufferGeometry("fdsfasd", {
        font: res,
        size: 100,
        height: 60
      });
      font.center();
      var map = new THREE.TextureLoader().load("./static/images/0.jpg");
      var material = new THREE.MeshLambertMaterial({map: map, side: THREE.DoubleSide});
      var fontModel = new THREE.Mesh(font, material);
      let renderPos = this.toRenderCoordinates(pos);
      fontModel.position.set(...renderPos);
      this.scene.add(fontModel);
      this.initRender();
    })
  }
}

